
import { Button, Modal, Form, Input, Select, InputNumber } from 'antd';
import React, { useState,useEffect } from 'react';
const { Option } = Select
const layout = {
    labelCol: {
        span: 5,
    },
    wrapperCol: {
        span: 16,
    },
};
const validateMessages = {
    required: '${label} is required!',

};

const EditModal = (props) => {
    

    const { editstate, editmyclick, myclick, editObj } = props
    // console.log(editObj);
    const onFinish = (values) => {
        // console.log(values);
        editmyclick(values)
    };
   
   
    return (
        <>
                
            <Modal title="编辑" open={editstate}  onCancel={myclick} destroyOnClose={true} footer={[]}>
                <Form {...layout} name="nest-messages" onFinish={onFinish} validateMessages={validateMessages}>
                    <Form.Item
                        name={['user', 'sname']}
                        label="任务名称"
                        rules={[
                            {
                                required: true,
                            },
                        ]}
                        initialValue={editObj.sname ? editObj.sname:""}
                    >
                        <Input />

                    </Form.Item>
                    <Form.Item
                        name={['user', 'sstate']}
                        label="状态"
                        rules={[
                            {
                                required: true,
                            },
                        ]}
                        initialValue={editObj.sstate ? editObj.sstate:""}
                    >
                        <Select placeholder='--请选择--' >
                            <Option value="启用">启用</Option>
                            <Option value="禁用">禁用</Option>

                        </Select>
                    </Form.Item>
                    <Form.Item
                        name={['user', 'key']}
                        label="任务编号"
                        rules={[
                            {
                                required: true,
                            },
                        ]}
                        initialValue={editObj.key ? editObj.key :""}
                    >
                        <Input />
                    </Form.Item>
                    <Form.Item
                        name={['user', 'sdepartment']}
                        label="责任部门"
                        rules={[
                            {
                                required: true,
                            },
                        ]}
                        initialValue={editObj.sdepartment ? editObj.sdepartment:""}
                    >
                        <Select placeholder='--请选择--'  >
                            <Option value="服务团队">服务团队</Option>
                            <Option value="产品研发中心">产品研发中心</Option>
                        </Select>
                    </Form.Item>
                    <Form.Item
                        name={['user', 'sjobs']}
                        label="责任岗位"
                        rules={[
                            {
                                required: true,
                            },
                        ]}
                        initialValue={editObj.sjobs? editObj.sjobs:""}
                    >
                        <Select placeholder='--请选择--'  >
                            <Option value="高级录入员">高级录入员</Option>
                            <Option value="基础录入员">基础录入员</Option>
                        </Select>
                    </Form.Item>
                    <Form.Item
                        name={['user', 'sstrategy']}
                        label="派工策略"
                        rules={[
                            {
                                required: true,
                            },
                        ]}
                        initialValue={editObj.sstrategy ? editObj.sstrategy:""}
                    >
                        <Select placeholder='--请选择--'>
                            <Option value="手动派工">手动派工</Option>
                            <Option value="自动派工-上线10">自动派工-上线10</Option>
                            <Option value="自动派工-传递">自动派工-传递</Option>

                        </Select>
                    </Form.Item>
                    <Form.Item
                        name={['user', 'suser']}
                        label="操作人"
                        rules={[
                            {
                                required: true,
                            },
                        ]}
                        initialValue={editObj.suser ? editObj.suser:""}
                    >
                        <Input  />

                    </Form.Item>
                    <Form.Item wrapperCol={{ ...layout.wrapperCol, offset: 18 }}>
                        <Button type="primary" htmlType="submit" >
                            提交
                        </Button>
                    </Form.Item>
                </Form>
            </Modal>
        </>
    );
};

export default EditModal;